from selenium.webdriver.common.by import By
from base.base import Base
from page.login import Login
from page.boss import Boss

class Agent(Boss):
    #点击新增地区
    new_agent = (By.XPATH,'/html/body/div/div/div[2]/div/div[1]/ul/li[3]/ul/li[2]')
    #输入名称
    username_loc = (By.XPATH,'/html/body/div/div/div[2]/div/div[2]/div[2]/form/div[1]/div/div/input')
    #输入序号
    pwd_loc = (By.XPATH,'/html/body/div/div/div[2]/div/div[2]/div[2]/form/div[2]/div/div/input')
    #点击提交
    tijiao_loc = (By.XPATH,'/html/body/div/div/div[2]/div/div[2]/div[2]/form/div[3]/div/button')

    def agent(self):
        self.click(self.new_agent)

    def username(self,di):
        self.send_keys(self.username_loc,di)

    def password(self,pww):
        self.send_keys(self.pwd_loc,pww)

    def tijia(self):
        self.click(self.tijiao_loc)

    #代理商地区列表
    diqu_loc = (By.XPATH,'/html/body/div/div/div[2]/div/div[1]/ul/li[3]/ul/li[1]')
    #输入地区名
    diqu_name_loc = (By.XPATH,'/html/body/div/div/div[2]/div/div[2]/div[2]/div/div[1]/div[2]/input')
    #输入id
    ID_loc = (By.XPATH,'/html/body/div/div/div[2]/div/div[2]/div[2]/div/div[1]/div[1]/input')
    #输入地区类型
    leixing_loc = (By.XPATH,'/html/body/div/div/div[2]/div/div[2]/div[2]/div/div[1]/div[3]/input')
    #点击搜索
    sousuo_loc = (By.XPATH,'/html/body/div/div/div[2]/div/div[2]/div[2]/div/div[1]/div[4]/button[2]')
    #点击清除
    qingchu_loc = (By.XPATH,'/html/body/div/div/div[2]/div/div[2]/div[2]/div/div[1]/div[4]/button[1]')

    def diqu(self):
        self.click(self.diqu_loc)

    def diname(self):
        self.send_keys(self.diqu_name_loc,'北方')

    def sousuo(self):
        self.click(self.sousuo_loc)

    def ID(self):
        self.send_keys(self.ID_loc,'15882')

    def leixing(self):
        self.send_keys(self.leixing_loc,'校园')


    """用例1。新增地区成功"""
    # def one_agent(self):
    #     self.agent()
    #     self.username(di)
    #     self.password(pww=)
    #     self.tijia()

    """用例2.输入存在地区名，搜索成功"""
    def two_agent(self):
        self.diqu()
        self.diname()
        self.sousuo()

    """用例3.输入输入存在ID，搜索成功"""
    def three_agent(self):
        self.diqu()
        self.ID()
        self.sousuo()

    """用例3。输入正确类型，搜索成功"""
    def four_agent(self):
        self.diqu()
        self.leixing()
        self.sousuo()



    """新增服务"""
    new_service = (By.XPATH,'/html/body/div/div/div[2]/div/div[1]/ul/li[2]/ul/li[3]')
    #代理id
    daili_id_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/div/form/div[2]/div/div/input')
    #用户收益
    user_shouyi_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/div/form/div[3]/div/div/input')
    #平台收益
    pingtai_shouyi_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/div/form/div[4]/div/div/input')
    #描述
    miaoshu_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/div/form/div[6]/div/div/input')
    #ICON
    icon_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/div/form/div[7]/div/div/input')
    #选择接单员
    jiedan_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/div/form/div[8]/div/button/span')
    #点击多选框
    checkbox_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/div/div/div/div[2]/div/div[3]/div[3]/table/tbody/tr[1]/td[1]/div/label/span/span')
    #点击确定
    queding_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/div/div/div/div[3]/span/button[2]/span')
    #点击保存
    baocun_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/div/form/div[10]/div/button/span')


    """新增代理"""
    new_user_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/form/div[1]/div/div/input')
    #输入密码
    mima_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/form/div[2]/div/div/input')
    #确认密码
    que_mima_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/form/div[3]/div/div/input')
    #手机号
    poent_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/form/div[6]/div/div/input')
    #立即注册
    zhuce_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/form/div[8]/div/button')
    #用户类型
    user_leixing_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/form/div[4]/div/div/div/input')
    #学校
    xuexiao_loc = (By.XPATH,'/html/body/div[2]/div[1]/div[1]/ul/li[2]')
    #区域
    quyu_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/form/div[5]/div/div/input')

    def users(self):
        self.send_keys(self.new_user_loc,'code')

    def mima(self):
        self.send_keys(self.mima_loc,'123123123')

    def que_mima(self):
        self.send_keys(self.que_mima_loc,'123123123')

    def pent(self):
        self.send_keys(self.poent_loc,'17333864259')

    def zhuce(self):
        self.click(self.zhuce_loc)

    def user_leixing(self):
        self.click(self.user_leixing_loc)

    def xuexiao(self):
        self.click(self.xuexiao_loc)

    def quyu(self):
        self.send_keys(self.quyu_loc,'14368')

    def new_Agent(self):
        self.users()
        self.mima()
        self.que_mima()
        self.user_leixing()
        self.xuexiao()
        self.pent()
        self.zhuce()


    """审核通过"""
    #通过
    tongguo_loc = (By.XPATH,'/html/body/div/div/div[2]/div/div[2]/div[2]/div/div[3]/div[3]/table/tbody/tr/td[10]/div/div/button[1]/span')
    #点击确定
    que_ding_loc = (By.XPATH,'/html/body/div[2]/div/div[3]/button[2]/span')
    """驳回"""
    bohui_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/div/div[3]/div[3]/table/tbody/tr[1]/td[10]/div/div/button[2]/span')
    #驳回信息
    bohui_xinxi_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/div/div[6]/div/div[2]/form/div[1]/div/div/input')
    #提交
    ti_jiao_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/div/div[2]/div[2]/div/div[6]/div/div[2]/form/div[2]/div/button[1]/span')
    #输入姓名
    xingming_loc = (By.XPATH,'/html/body/div/div/div[2]/div/div[2]/div[2]/div/div[1]/div[2]/input')
    #搜素
    sou_loc = (By.XPATH,'/html/body/div/div/div[2]/div/div[2]/div[2]/div/div[1]/div[5]/button[2]/span')


    #点击审核通过
    def tongguo(self):
        self.click(self.tongguo_loc)

    #点击确定
    def queding(self):
        self.click(self.que_ding_loc)

    #点击驳回
    def bohui(self):
        self.click(self.bohui_loc)

    #输入驳回信息
    def bohui_xinxi(self):
        self.send_keys(self.bohui_xinxi_loc,'孤馆')

    #点击提交
    def ti_jiao(self):
        self.click(self.ti_jiao_loc)

    def jiedanyuan_01(self):
        self.xingming()
        self.sou()
        self.bohui()
        self.bohui_xinxi()
        self.ti_jiao()

    def jiedanyuan_02(self):
        self.xingming()
        self.sou()
        self.tongguo()
        self.queding()

    #输入姓名
    def xingming(self):
        self.send_keys(self.xingming_loc,'孤馆')

    #点击搜索
    def sou(self):
        self.click(self.sou_loc)
